#ifndef THRESHOLDFORM_H
#define THRESHOLDFORM_H

#include "DGVGlobal.h"
#include "ui_threshold.h"

/*!
    \class ThresholdForm
    \brief This class represents the threshold form.

    It has two sliders to ask the user the threshold levels for the display of data. EXPERIMENTAL
*/
class DGV_EXPORT ThresholdForm : public QDialog
{
    Q_OBJECT

public:
    ThresholdForm(QWidget *parent = 0, Qt::Orientation orientation = Qt::Horizontal,
        QwtSlider::ScalePos scalePos = QwtSlider::NoScale, QwtSlider::BGSTYLE bgStyle = QwtSlider::BgTrough);
    virtual ~ThresholdForm();

    inline void setUpperValue(double value)
    {   ui.SliderHigh->setValue(value); }
    inline void setLowerValue(double value)
    {   ui.SliderLow->setValue(value);  }
    void setMax(double max);
    void setMin(double min);
    void setStep(double interval);
    void setNoOfMajorTicks(int ticks);
    void setNoOfMinorTicks(int ticks);

    inline double getUpperValue()
    {   return ui.SliderHigh->value();  }
    inline double getLowerValue()
    {   return ui.SliderLow->value();   }

public slots:
    /*!
        \fn ThresholdForm::updateUpperValue(double value)
        \brief Re-emits upper value changed signal to outside world.
    */
    void updateUpperValue(double value);
    /*!
        \fn ThresholdForm::updateLowerValue(double value)
        \brief Re-emits lower value changed signal to outside world.
    */
    void updateLowerValue(double value);

signals:
    /*!
        \fn ThresholdForm::upperValueChanged(double)
        \brief Send signal when upper threshold value changes.
    */
    void upperValueChanged(double);
    /*!
        \fn ThresholdForm::lowerValueChanged(double)
        \brief Send signal when lower threshold value changes.
    */
    void lowerValueChanged(double);

protected:
    Ui::Threshold ui;

    double maxValue;
    double minValue;
    double stepValue;
    bool scaleDrawn;
    bool usingTicks;

    void updateScales();
    void createConnections();
};

#endif // THRESHOLDFORM_H
